package com.engineering.elink.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import java.util.Map;

import javax.validation.Valid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.engineering.elink.co.BaseCo;
import com.engineering.elink.service.SubjectService;

/**
 * 专题
 * @author hxjxiaojun
 *@time 2017年2月15日
 */
@Controller
@CrossOrigin
@RequestMapping("/api/subject")
@Api(value = "专题接口")
public class SubjectController {
	@Autowired
	private SubjectService subjectService;
	
	/**
	 * 获取专题
	 * @param co
	 * @return
	 */
	@RequestMapping(value="/getList",method = RequestMethod.GET)
	@ApiOperation(value = "专题列表",httpMethod="GET")
	@ResponseBody
	public Map<String, Object> getList(@ModelAttribute @Valid BaseCo co){
		return subjectService.getList(co);
	}
	
	
	/**
	 * 
	 * 获取专题基本信息
	 * @param subjectId
	 * @return
	 */
	@RequestMapping(value="/getBaseInfo",method = RequestMethod.GET)
	@ApiOperation(value = "专题基本信息",httpMethod="GET")
	@ResponseBody
	public Map<String, Object> getBaseInfo(@ApiParam(value="专题主键",required=true)
	@RequestParam(value="subjectId",required=true) String subjectId){
		return subjectService.getBaseInfo(subjectId);
	}
	
	
	/**
	 * 
	 * 获取详情
	 * @param subjectId
	 * @return
	 */
	@RequestMapping(value="/getInfo",method = RequestMethod.GET)
	@ApiOperation(value = "专题详情",httpMethod="GET")
	@ResponseBody
	public Map<String, Object> getInfo(@ApiParam(value="专题主键",required=true)
	@RequestParam(value="subjectId",required=true) String subjectId){
		return subjectService.getInfo(subjectId);
	}
}
